#!/bin/bash
DATE="`date +"%Y-%m-%d %H:%M:%S"`"
ipaddr=(20.1.5.12 20.1.5.13 20.1.5.14 20.1.5.15 20.1.5.16 20.1.5.17 20.1.5.18 20.1.5.19 20.1.5.20 20.1.5.21 20.1.5.22 20.1.5.31 20.1.5.32 20.1.5.34 20.1.5.35 20.1.5.36 20.1.5.42 20.1.5.43 20.1.5.60 20.1.5.100)
#ipaddr=$(more /var/log/hosts.txt)

for i in ${ipaddr[*]}
do
if ping -c 1 -W 1 ${i} > /dev/null 2>&1
then
    echo "$DATE ping ${i} is successful!"
else
    echo "$DATE ping ${i} is failure!"
fi
done

